//
//  UIView+UIViewController.m
//  Custom_Weibo
//
//  Created by LEO on 12/14/15.
//  Copyright © 2015 Leo_Lei. All rights reserved.
//

#import "UIView+UIViewController.h"

@implementation UIView (UIViewController)

// Find the target responder through the responder chain
- (UIViewController *)belongingController {
    UIResponder *responder = self.nextResponder;
    while (responder != nil) {
        if ([responder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)responder;
        }
        responder = responder.nextResponder;
    }
    return nil;
}

@end
